<extend name="Base/mob_common"/>
<block name="mob_header">
    <div data-am-widget="header" class="am-header am-header-default am-header-fixed">
        <link rel="stylesheet" href="__CSS__/apps/event.css"/>
        <script src="__JS__/event.js"></script>

        <div class="am-header-left am-header-nav">
            <a href="javascript:history.go(-1);"><span class="am-icon-chevron-left"></span></a>
        </div>
        <h1 class="am-header-title">
            报名
        </h1>

        <div class="am-header-right am-header-nav">

        </div>
    </div>
</block>
<block name="mob_body">



    <form action="{:U('doSign')}" method="post" class="am-form" id="msg">
        <input id="event_id" name="event_id" type="hidden" class="form-control" value="{$event.id}"/>



    <fieldset>
        <legend>个人报名</legend>

        <div class="event_info"style="">


            <div class="info_title">活动时间：<span>  {:date('Y-m-d',$event['sTime'])}--{:date('Y-m-d',$event['eTime'])}</span></div>



            <div class="info_title">报名截止时间：  <span>   {:date('Y-m-d H:i',$event['deadline'])}</span></div>



            <div class="info_title">人数限制：<span>   {$event.limitCount} </span>
            </div>



            <div class="info_title">已报名：<span> {$event.attentionCount}</span></div>



            <div class="info_title">剩余人数：  <span>{$event['limitCount']-$event['attentionCount']}</span></div>



            <div class="info_title">地点：     <span>   {$event.address}</span></div>



        </div>

        <div class="am-form-group">
            <label>姓名：</label>
            <input name="name"  type="text" minlength="2"  maxlength="10"  placeholder="请输入姓名" required/>

        </div>

        <div class="am-form-group">
            <label>手机号码：</label>
            <input  name="phone" type="text" pattern="^1[3,5,8]\d{9}$" placeholder="请输入正确的手机号码" data-validation-message="请输入正确的手机号码" required/>
        </div>

    </fieldset>


        <button type="button" data-role="submit_form" class="am-btn am-btn-primary am-btn-block">报名参加</button>

</form>


    <script>
        $(function(){
            $('[data-role="submit_form"]').click(function(e){
                e.preventDefault()
                var $this = $(this);
                var $form = $this.closest('form');
                var data = $form.serialize();
                var url = $form.attr('action');
                $.post(url, data, function (msg) {
                    if (msg.status == 1) {
                        toast.success(msg.info);
                        setTimeout(function () {
                            window.location.href = document.referrer
                        },1000)
                    } else {
                        toast.error(msg.info);
                    }
                }, 'json');


            })
        })



        //上传单个文件
        var add_one_file = function () {
            $('#fileone').fileupload({
                dataType: 'json',
                done: function (e, result) {
                    var $fname = $("#file_name");
                    var ids = $('#team_file_id').val(result.result.data[0].id);
                    if(!ids){
                        $fname.text('上传失败');
                    }
                    var name = result.result.data[0].name;
                    if (!ids == null) {
                        $('.show_box').hide();
                    } else {
                        $('.show_box').show();
                    }

                    $fname.html('').text(name);

                },
                progressall: function (e, data) {
                    var progress = parseInt(data.loaded / data.total * 100, 10);
                    $('#progress .bar').css(
                            'width',
                            progress + '%'
                    );
                }

            });
        };
    </script>





</block>


